package 测试;

import java.util.Arrays;

public class 无序数组中最小的k个数 {

	public static void main(String[] args) {

	}

	public static class KthNumbers {
		public int[] findKthNumbers(int[] A, int n, int k) {
			int[] a = Arrays.copyOf(A, A.length);
			Arrays.sort(a);
			int[] r = new int[k];

			for (int i = 0, j = 0; i < n && j < k; i++) {
				if (A[i] <= a[k - 1]) {
					r[j++] = A[i];
				}
			}

			return r;
		}
	}
}
